package com.alibaba.yinan.adapter;

import com.alibaba.yinan.client.api.TaskFacade;
import com.alibaba.yinan.client.dto.CreateAndDispatchTaskCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName TaskController
 * @Author mengke
 * @create 2025/8/4 02:35
 * @Description
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/task")
public class TaskController {

    private final TaskFacade taskFacade;

    @PostMapping("/dispatch")
    public ResponseEntity<Void> dispatch(@RequestBody CreateAndDispatchTaskCmd cmd) {
        taskFacade.createAndDispatch(cmd);
        return ResponseEntity.ok().build();
    }
}